package com.oceansoft.mobile.biz.admin.entity;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

@JsonIgnoreProperties({"bytes"})
public class BasesiteArticlePic {

    private long id;
    private String originalName;
    private String fileName;
    private long fileSize;
    private String fileType;
    private String suffix;
    private byte[] bytes;
    private String author;
    private String url;
    private String dpi;
    private Date time = new Date();
    private String summary;
    private String title;
    private long productId;
    private int topFlag;
    private String catalog;

    public BasesiteArticlePic() {
    }

    public BasesiteArticlePic(String url) {
        this.url = url;
    }

    public static RowMapper<BasesiteArticlePic> getUrlRowMapper() {
        return new RowMapper<BasesiteArticlePic>() {
            @Override
            public BasesiteArticlePic mapRow(ResultSet rs, int rowNum) throws SQLException {
                return new BasesiteArticlePic(rs.getString("URL"));
            }
        };
    }

    public static RowMapper<BasesiteArticlePic> getFullRowMapper() {
        return new RowMapper<BasesiteArticlePic>() {
            @Override
            public BasesiteArticlePic mapRow(ResultSet rs, int rowNum) throws SQLException {
                BasesiteArticlePic obj = new BasesiteArticlePic();
                obj.setId(rs.getLong("ID"));
                obj.setProductId(rs.getLong("PID"));
                obj.setAuthor(rs.getString("AUTHOR"));
                obj.setFileSize(rs.getInt("SIZE"));
                obj.setDpi(rs.getString("DPI"));
                obj.setTime(rs.getTimestamp("TIME"));
                obj.setSummary(rs.getString("SUMMARY"));
                obj.setUrl(rs.getString("URL"));
                obj.setTitle(rs.getString("TITLE"));
                obj.setFileName(rs.getString("FILE_NAME"));
                obj.setOriginalName(rs.getString("ORIG_NAME"));
                obj.setTopFlag(rs.getInt("TOP_FLAG"));
                obj.setCatalog(rs.getString("CATALOG"));
                return obj;
            }
        };
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public long getFileSize() {
        return fileSize;
    }

    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }

    public String getFileType() {
        return fileType;
    }

    public void setFileType(String fileType) {
        this.fileType = fileType;
    }

    public byte[] getBytes() {
        return bytes;
    }

    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getDpi() {
        return dpi;
    }

    public void setDpi(String dpi) {
        this.dpi = dpi;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public long getProductId() {
        return productId;
    }

    public void setProductId(long productId) {
        this.productId = productId;
    }

    public int getTopFlag() {
        return topFlag;
    }

    public void setTopFlag(int topFlag) {
        this.topFlag = topFlag;
    }

    public String getCatalog() {
        return catalog;
    }

    public void setCatalog(String catalog) {
        this.catalog = catalog;
    }
}
